feat: add MaybeDontAnalyzer security analyzer#2142
feat: add MaybeDontAnalyzer security analyzer#2142robotdan wants to merge 4 commits intoOpenHands:mainfrom
Conversation
Implements a SecurityAnalyzerBase that validates agent actions against policy rules configured in a Maybe Don't Gateway instance. Calls the gateway's POST /api/v1/action/validate endpoint and maps the response risk_level directly to SecurityRisk. - MaybeDontAnalyzer class following GraySwan patterns - 41 tests covering init, request building, risk mapping, error handling, HTTP lifecycle, and end-to-end security_risk flow - Example script (40_maybedont_security_analyzer.py) - Exported from openhands.sdk.security module Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add MAYBE_DONT_SERVER_LISTEN_ADDR=0.0.0.0:8080 (127.0.0.1 unreachable from host) - Disable AI validation and audit report (require OpenAI API key) - Match Docker command to docs PR (OpenHands/docs#350) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[Automatic Post]: I have assigned @rbren as a reviewer based on git blame information. Thanks in advance for the help! |
|
[Automatic Post]: This PR seems to be currently waiting for review. @rbren, could you please take a look when you have a chance? |
|
[Automatic Post]: It has been a while since there was any activity on this PR. @robotdan, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
1 similar comment
|
[Automatic Post]: It has been a while since there was any activity on this PR. @robotdan, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. |
|
[Automatic Post]: This PR seems to be currently waiting for review. @rbren, could you please take a look when you have a chance? |
Summary
Adds
MaybeDontAnalyzer, a newSecurityAnalyzerBaseimplementation that validates agent actions against policy rules configured in a Maybe Don't Gateway instance.POST /api/v1/action/validateendpoint before action executionActionEventfields (tool_name,tool_call.arguments,thought,summary) to the gateway's request formatrisk_levelresponse directly toSecurityRisk(HIGH/MEDIUM/LOW/UNKNOWN)UNKNOWNmodel_post_initenv var resolution,set_events/closelifecycleHow it fits with existing integrations
MaybeDont doc for OpenHands
Configuration
Files
openhands-sdk/openhands/sdk/security/maybedont/analyzer.pyMaybeDontAnalyzerclassopenhands-sdk/openhands/sdk/security/maybedont/__init__.pyopenhands-sdk/openhands/sdk/security/__init__.py__all__tests/sdk/security/maybedont/test_maybedont_analyzer.pyexamples/01_standalone_sdk/40_maybedont_security_analyzer.pyRelated
Test plan
uv run pytest tests/sdk/security/maybedont/ -v— 41 tests passuv run pytest tests/sdk/security/ -v— 119 tests pass (no regressions)make format && make lint— cleanrm -rf→ HIGH, safe commands → LOW)🤖 Generated with Claude Code